/********************************************************************************
 *      Copyright:  (C) 2020 wangruijie<1046299465@qq.com>
 *                  All rights reserved.
 *
 *       Filename:  main_serial.h
 *    Description:  This head file 
 *
 *        Version:  1.0.0(09/07/20)
 *         Author:  wangruijie <1046299465@qq.com>
 *      ChangeLog:  1, Release initial version on "09/07/20 06:11:17"
 *                 
 ********************************************************************************/
#include<signal.h>
#include<time.h>
#include<libgen.h>

int    g_stop = 0;

void sighandler(int sig_num)
{
    if(sig_num == SIGINT)
    {
        g_stop = 1;
    }
}

void print_usage(const char *program_name)
{
    printf("\tUsage: %s [-d DELAY] [-t TIMEOUT] [-s SPEED] TTY\n",program_name) ;
    printf("\t-n      device TTY name you want to open\n\n") ;
    printf("\t-b      Set serial BaudRate\n") ;
    printf("\t-d      Set serial DataBit\n") ;
    printf("\t-p      Set serial Parity\n") ;
    printf("\t-s      Set serial StopBit\n") ;
    printf("\t-f      Set serial Flowctrl\n") ;

    printf("\t-t      Set TIMEOUT read from serial\n") ;
    printf("\tCtrl+c to exit %s...\n",program_name) ;
}
